UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '96Onio0V4Xm6Zmn0wN/l2ueVW0f22Gi+ZhY9M7lFylw=' 
WHERE 
  key_id = 'e5c3376b43eb28d00b397a19e2b830420023421dd09cbee50084d7077e8cee51' 
  AND (
    token = '96Onio0V4Xm6Zmn0wN/l2ueVW0f22Gi+ZhY9M7lFylw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029