UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SqSI7GrvX25nCF7h3ZNm3mTunlQXXg+y+z1A4lHf7Dc=' 
WHERE 
  key_id = '5a780a5b1b3665f3d847be55202be46fdb852a88a428997daf8a8383cbf4333e' 
  AND (
    token = 'SqSI7GrvX25nCF7h3ZNm3mTunlQXXg+y+z1A4lHf7Dc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038