UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'FgWnugvKmJPgdJDg1amVNGUS3gG42NR80DzEtJ1Z8ZM=' 
WHERE 
  key_id = 'ef36b41267562a51460877dc427fd9c9cdbc9a6e540382e2eedaf45019a745a9' 
  AND (
    token = 'FgWnugvKmJPgdJDg1amVNGUS3gG42NR80DzEtJ1Z8ZM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025