UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4q0w1u8NKSTTsctAL0qPHhIW6FqsfaE2Q4Nm7a3t4xc=' 
WHERE 
  key_id = 'eac372ff491155e0a1a97929e6fceb17df6f09c53f5185aad10a05380d0136e3' 
  AND (
    token = '4q0w1u8NKSTTsctAL0qPHhIW6FqsfaE2Q4Nm7a3t4xc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040