UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Plm0UyfyI+6Jhho/qo8UxuU54DDoGWSapK1DlAzxCQk=' 
WHERE 
  key_id = '0d8a04e424f56233f15bc6de65820ded1ab82518e40fe8b9d65525ea958f1051' 
  AND (
    token = 'Plm0UyfyI+6Jhho/qo8UxuU54DDoGWSapK1DlAzxCQk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039