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

Query time 0.00037