UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BPX6BmGsxDqp6Z0E0H4dk0qLe5SOo1oSbzJOemhmFtk=' 
WHERE 
  key_id = '1a296da08e750f1bb743a429403a396aaeab837cdd3c8bc3770e369a79180d01' 
  AND (
    token = 'BPX6BmGsxDqp6Z0E0H4dk0qLe5SOo1oSbzJOemhmFtk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045